
import createjs from 'createjs-ts'
const sprite = {};
/**
 * 游戏地图
 */
export class GameMap extends createjs.Container {
	constructor({ x, y, width, height } = {}) {
		super();
		let rect = new createjs.Shape(),
			step = 40,
			w = width,
			h = height,
			gr = rect.graphics; // Graphics  图形类
		/**
		 * 绘画网格
		 */
		gr.beginStroke('#F5F5F5');
		// 竖线
		for (let i = step; i < w; i += step) {
			gr.moveTo(i, 0);
			gr.lineTo(i, h);
		}
		// 横线
		for (let i = step; i < h; i += step) {
			gr.moveTo(0, i);
			gr.lineTo(w, i);
		}
		gr.endStroke();

		/**
		 *外围边框
		 * */ 
		gr.beginStroke("#000");
		gr.setStrokeStyle(4);
		gr.drawRect(0, 0, w, h);
		gr.endStroke();

		this.type = "GameMap"
		this.x = x;
		this.y = y;
		this.addChild(rect);
	}
}

export default sprite;